package sctu.edu.java.year2016.team07.shihaocheng;

/**
 * Created by admin on 2016/6/15.
 */
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class BackStageSupporter {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        String rec = new String();

        System.out.println("请输入你的问题：");

        String pro = scan.next();

        System.out.println("请输入您的地址，我们将派工作人员前来修理：");

        String add = scan.next();









            String path = "d:";

            File f = new File(path);



            if(!f.exists()){
                f.mkdirs();
            }
// 你创建problem；为txt类型；
            String fileName="problem.txt";


            File file = new File(f,fileName);


            if(!file.exists()){

                try {
                    file.createNewFile();
                }

                catch (IOException e) {
                    e.printStackTrace();
                }
            }


            try {
                FileOutputStream in = new FileOutputStream(file);



                byte bt[] = new byte[1024];

                bt = pro.getBytes();
                try {
                    in.write(bt, 0, bt.length);
                    in.close();
                    // boolean success=true;
                    // System.out.println("写入文件成功");
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }


        System.out.println("请输入该问题的解决方案：");

        String solu = scan.next();

        try {
            FileOutputStream in = new FileOutputStream(file/*知识库系统*/);



            byte bt[] = new byte[1024];

            bt = pro.getBytes();
            try {
                in.write(bt, 0, bt.length);
                in.close();
                // boolean success=true;
                // System.out.println("写入文件成功");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        }
    }

